From 0bad2bcf48bf6797d05561c375bf00421ef17484 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Fri, 6 Apr 2018 00:53:16 +0200 Subject: [PATCH] float-half: half fast paths for premultiplied alpha --- extensions/float-half.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/extensions/float-half.c b/extensions/float-half.c index 2c09ba0..7116671 100644 --- a/extensions/float-half.c +++ b/extensions/float-half.c @@ -252,6 +252,8 @@ conv_rgbaHalf_rgbaF (const Babl *conversion,const uint16_t *src, float *dst, lon conv_yHalf_yF (conversion, src, dst, samples * 4); } +#define conv_rgbAHalf_rgbAF conv_rgbaHalf_rgbaF + static inline void conv_yF_yHalf (const Babl *conversion,const float *src, uint16_t *dst, long samples) { @@ -276,6 +278,8 @@ conv_rgbaF_rgbaHalf (const Babl *conversion,const float *src, uint16_t *dst, lon conv_yF_yHalf (conversion, src, dst, samples * 4); } +#define conv_rgbAF_rgbAHalf conv_rgbaF_rgbaHalf + static void singles2halfp2(void *target, const void *source, long numel) { uint16_t *hp = (uint16_t *) target; // Type pun output as an unsigned 16-bit int @@ -369,6 +373,39 @@ init (void) babl_component ("B"), babl_component ("A"), NULL); + const Babl *rgbAF_linear = babl_format_new ( + babl_model ("RaGaBaA"), + babl_type ("float"), + babl_component ("Ra"), + babl_component ("Ga"), + babl_component ("Ba"), + babl_component ("A"), + NULL); + const Babl *rgbAHalf_linear = babl_format_new ( + babl_model ("RaGaBaA"), + babl_type ("half"), + babl_component ("Ra"), + babl_component ("Ga"), + babl_component ("Ba"), + babl_component ("A"), + NULL); + const Babl *rgbAF_gamma = babl_format_new ( + babl_model ("R'aG'aB'aA"), + babl_type ("float"), + babl_component ("R'a"), + babl_component ("G'a"), + babl_component ("B'a"), + babl_component ("A"), + NULL); + const Babl *rgbAHalf_gamma = babl_format_new ( + babl_model ("R'aG'aB'aA"), + babl_type ("half"), + babl_component ("R'a"), + babl_component ("G'a"), + babl_component ("B'a"), + babl_component ("A"), + NULL); + const Babl *rgbaHalf_linear = babl_format_new ( babl_model ("RGBA"), babl_type ("half"), @@ -485,6 +522,8 @@ init (void) babl_conversion_new (src ## _gamma, dst ## _gamma, "linear", conv2_ ## src ## _ ## dst, NULL); \ } + CONV(rgbAHalf, rgbAF); + CONV(rgbAF, rgbAHalf); CONV(rgbaHalf, rgbaF); CONV(rgbHalf, rgbF); CONV(yaHalf, yaF); -- 2.30.2